﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Common;
using Atom.Entity;
using Atom.Entity.Medicare;
using System.Data;
using Atom.Utility.Data;
using Atom.Interface.DataAccess;
using System.Data.Odbc;

namespace Atom.DAL.Medicare
{
    /// <summary>
    /// 数据访问类BAZADAL。
    /// </summary>
    public class BAZADAL : BaseDAL
    {
        public BAZADAL()
        { }
        #region  成员方法

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public SqlExecuteResult Add(Atom.Entity.Medicare.BAZAEntity model, DbTransaction trans)
        {
            StringBuilder strSql = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();
            #region 拼sql语句

            if (model.BAZA01 != null)
            {
                strSql1.Append("BAZA01,");
                strSql2.Append("'" + model.BAZA01 + "',");
            }
            if (model.BAZA02 != null)
            {
                strSql1.Append("BAZA02,");
                strSql2.Append("'" + model.BAZA02 + "',");
            }
            if (model.BAZA03 != null)
            {
                strSql1.Append("BAZA03,");
                strSql2.Append("'" + model.BAZA03 + "',");
            }
            if (model.BAZA04 != null)
            {
                strSql1.Append("BAZA04,");
                strSql2.Append("{^" + Convert.ToDateTime(model.BAZA04).ToString("yyyy-MM-dd") + "},");
            }
            if (model.BAZA05 != null)
            {
                strSql1.Append("BAZA05,");
                strSql2.Append("'" + model.BAZA05 + "',");
            }
            if (model.BAZA06 != null)
            {
                strSql1.Append("BAZA06,");
                strSql2.Append("" + model.BAZA06 + ",");
            }
            if (model.BAZA07 != null)
            {
                strSql1.Append("BAZA07,");
                strSql2.Append("'" + model.BAZA07 + "',");
            }
            if (model.BAZA08 != null)
            {
                strSql1.Append("BAZA08,");
                strSql2.Append("'" + model.BAZA08 + "',");
            }
            if (model.BAZA09 != null)
            {
                strSql1.Append("BAZA09,");
                strSql2.Append("'" + model.BAZA09 + "',");
            }
            if (model.BAZA10 != null)
            {
                strSql1.Append("BAZA10,");
                strSql2.Append("'" + model.BAZA10 + "',");
            }
            if (model.BAZA11 != null)
            {
                strSql1.Append("BAZA11,");
                strSql2.Append("'" + model.BAZA11 + "',");
            }
            if (model.BAZA12 != null)
            {
                strSql1.Append("BAZA12,");
                strSql2.Append("'" + model.BAZA12 + "',");
            }
            if (model.BAZA13 != null)
            {
                strSql1.Append("BAZA13,");
                strSql2.Append("'" + model.BAZA13 + "',");
            }
            if (model.BAZA14 != null)
            {
                strSql1.Append("BAZA14,");
                strSql2.Append("'" + model.BAZA14 + "',");
            }
            if (model.BAZA15 != null)
            {
                strSql1.Append("BAZA15,");
                strSql2.Append("'" + model.BAZA15 + "',");
            }
            if (model.BAZA16 != null)
            {
                strSql1.Append("BAZA16,");
                strSql2.Append("'" + model.BAZA16 + "',");
            }
            if (model.BAZA17 != null)
            {
                strSql1.Append("BAZA17,");
                strSql2.Append("'" + model.BAZA17 + "',");
            }
            if (model.BAZA18 != null)
            {
                strSql1.Append("BAZA18,");
                strSql2.Append("'" + model.BAZA18 + "',");
            }
            if (model.BAZA19 != null)
            {
                strSql1.Append("BAZA19,");
                strSql2.Append("'" + model.BAZA19 + "',");
            }
            if (model.BAZA20 != null)
            {
                strSql1.Append("BAZA20,");
                strSql2.Append("'" + model.BAZA20 + "',");
            }
            if (model.BAZA21 != null)
            {
                strSql1.Append("BAZA21,");
                strSql2.Append("'" + model.BAZA21 + "',");
            }
            if (model.BAZA22 != null)
            {
                strSql1.Append("BAZA22,");
                strSql2.Append("'" + model.BAZA22 + "',");
            }
            if (model.BAZA23 != null)
            {
                strSql1.Append("BAZA23,");
                strSql2.Append("'" + model.BAZA23 + "',");
            }
            if (model.BAZA24 != null)
            {
                strSql1.Append("BAZA24,");
                // strSql2.Append("'" + model.BAZA24 + "',");
                strSql2.Append("{^" + Convert.ToDateTime(model.BAZA24).ToString("yyyy-MM-dd") + "},");
            }
            if (model.BAZA25 != null)
            {
                strSql1.Append("BAZA25,");
                strSql2.Append("'" + model.BAZA25 + "',");
            }
            if (model.BAZA26 != null)
            {
                strSql1.Append("BAZA26,");
                strSql2.Append("'" + model.BAZA26 + "',");
            }
            if (model.BAZA27 != null)
            {
                strSql1.Append("BAZA27,");
                //strSql2.Append("'" + model.BAZA27 + "',");
                strSql2.Append("{^" + Convert.ToDateTime(model.BAZA27).ToString("yyyy-MM-dd") + "},");

            }
            if (model.BAZA28 != null)
            {
                strSql1.Append("BAZA28,");
                strSql2.Append("'" + model.BAZA28 + "',");
            }
            if (model.BAZA29 != null)
            {
                strSql1.Append("BAZA29,");
                strSql2.Append("" + model.BAZA29 + ",");
            }
            if (model.BAZA30 != null)
            {
                strSql1.Append("BAZA30,");
                //strSql2.Append("'" + model.BAZA30 + "',");
                strSql2.Append("{^" + Convert.ToDateTime(model.BAZA30).ToString("yyyy-MM-dd") + "},");

            }
            if (model.BAZA31 != null)
            {
                strSql1.Append("BAZA31,");
                strSql2.Append("" + model.BAZA31 + ",");
            }
            if (model.BAZA32 != null)
            {
                strSql1.Append("BAZA32,");
                strSql2.Append("'" + model.BAZA32 + "',");
            }
            if (model.BAZA33 != null)
            {
                strSql1.Append("BAZA33,");
                strSql2.Append("'" + model.BAZA33 + "',");
            }
            if (model.BAZA34 != null)
            {
                strSql1.Append("BAZA34,");
                strSql2.Append("'" + model.BAZA34 + "',");
            }
            if (model.BAZA35 != null)
            {
                strSql1.Append("BAZA35,");
                strSql2.Append("'" + model.BAZA35 + "',");
            }
            if (model.BAZA36 != null)
            {
                strSql1.Append("BAZA36,");
                strSql2.Append("'" + model.BAZA36 + "',");
            }
            if (model.BAZA37 != null)
            {
                strSql1.Append("BAZA37,");
                strSql2.Append("'" + model.BAZA37 + "',");
            }
            if (model.BAZA38 != null)
            {
                strSql1.Append("BAZA38,");
                strSql2.Append("'" + model.BAZA38 + "',");
            }
            if (model.BAZA39 != null)
            {
                strSql1.Append("BAZA39,");
                strSql2.Append("'" + model.BAZA39 + "',");
            }
            if (model.BAZA40 != null)
            {
                strSql1.Append("BAZA40,");
                strSql2.Append("'" + model.BAZA40 + "',");
            }
            if (model.BAZA41 != null)
            {
                strSql1.Append("BAZA41,");
                strSql2.Append("'" + model.BAZA41 + "',");
            }
            if (model.BAZA42 != null)
            {
                strSql1.Append("BAZA42,");
                strSql2.Append("" + model.BAZA42 + ",");
            }
            if (model.BAZA43 != null)
            {
                strSql1.Append("BAZA43,");
                strSql2.Append("'" + model.BAZA43 + "',");
            }
            if (model.BAZA44 != null)
            {
                strSql1.Append("BAZA44,");
                strSql2.Append("'" + model.BAZA44 + "',");
            }
            if (model.BAZA44A != null)
            {
                strSql1.Append("BAZA44a,");
                strSql2.Append("'" + model.BAZA44A + "',");
            }
            if (model.BAZA45 != null)
            {
                strSql1.Append("BAZA45,");
                strSql2.Append("'" + model.BAZA45 + "',");
            }
            if (model.BAZA46 != null)
            {
                strSql1.Append("BAZA46,");
                strSql2.Append("" + model.BAZA46 + ",");
            }
            if (model.BAZA47 != null)
            {
                strSql1.Append("BAZA47,");
                strSql2.Append("" + model.BAZA47 + ",");
            }
            if (model.BAZA48 != null)
            {
                strSql1.Append("BAZA48,");
                strSql2.Append("'" + model.BAZA48 + "',");
            }
            if (model.BAZA49 != null)
            {
                strSql1.Append("BAZA49,");
                strSql2.Append("'" + model.BAZA49 + "',");
            }
            if (model.BAZA50 != null)
            {
                strSql1.Append("BAZA50,");
                strSql2.Append("'" + model.BAZA50 + "',");
            }
            if (model.BAZA51 != null)
            {
                strSql1.Append("BAZA51,");
                strSql2.Append("'" + model.BAZA51 + "',");
            }
            if (model.BAZA52 != null)
            {
                strSql1.Append("BAZA52,");
                strSql2.Append("'" + model.BAZA52 + "',");
            }
            if (model.BAZA53 != null)
            {
                strSql1.Append("BAZA53,");
                strSql2.Append("'" + model.BAZA53 + "',");
            }
            if (model.BAZA54 != null)
            {
                strSql1.Append("BAZA54,");
                strSql2.Append("'" + model.BAZA54 + "',");
            }
            if (model.BAZA54A != null)
            {
                strSql1.Append("BAZA54A,");
                strSql2.Append("'" + model.BAZA54A + "',");
            }
            if (model.BAZA55 != null)
            {
                strSql1.Append("BAZA55,");
                strSql2.Append("'" + model.BAZA55 + "',");
            }
            if (model.BAZA56 != null)
            {
                strSql1.Append("BAZA56,");
                strSql2.Append("'" + model.BAZA56 + "',");
            }
            if (model.BAZA57 != null)
            {
                strSql1.Append("BAZA57,");
                strSql2.Append("'" + model.BAZA57 + "',");
            }
            if (model.BAZA58 != null)
            {
                strSql1.Append("BAZA58,");
                strSql2.Append("'" + model.BAZA58 + "',");
            }
            if (model.BAZA59 != null)
            {
                strSql1.Append("BAZA59,");
                strSql2.Append("'" + model.BAZA59 + "',");
            }
            if (model.BAZA60 != null)
            {
                strSql1.Append("BAZA60,");
                //strSql2.Append("'" + model.BAZA60 + "',");
                strSql2.Append("{^" + Convert.ToDateTime(model.BAZA60).ToString("yyyy-MM-dd") + "},");

            }
            if (model.BAZA61 != null)
            {
                strSql1.Append("BAZA61,");
                strSql2.Append("'" + model.BAZA61 + "',");
            }
            if (model.BAZA62 != null)
            {
                strSql1.Append("BAZA62,");
                strSql2.Append("'" + model.BAZA62 + "',");
            }
            if (model.BAZA63 != null)
            {
                strSql1.Append("BAZA63,");
                strSql2.Append("'" + model.BAZA63 + "',");
            }
            if (model.BAZA64 != null)
            {
                strSql1.Append("BAZA64,");
                strSql2.Append("'" + model.BAZA64 + "',");
            }
            if (model.BAZA65 != null)
            {
                strSql1.Append("BAZA65,");
                strSql2.Append("'" + model.BAZA65 + "',");
            }
            if (model.BAZA66 != null)
            {
                strSql1.Append("BAZA66,");
                strSql2.Append("'" + model.BAZA66 + "',");
            }
            if (model.BAZA67 != null)
            {
                strSql1.Append("BAZA67,");
                strSql2.Append("'" + model.BAZA67 + "',");
            }
            if (model.BAZA68 != null)
            {
                strSql1.Append("BAZA68,");
                strSql2.Append("'" + model.BAZA68 + "',");
            }
            if (model.BAZA69 != null)
            {
                strSql1.Append("BAZA69,");
                strSql2.Append("'" + model.BAZA69 + "',");
            }
            if (model.BAZA70 != null)
            {
                strSql1.Append("BAZA70,");
                strSql2.Append("'" + model.BAZA70 + "',");
            }
            if (model.BAZA71 != null)
            {
                strSql1.Append("BAZA71,");
                strSql2.Append("'" + model.BAZA71 + "',");
            }
            if (model.BAZA72 != null)
            {
                strSql1.Append("BAZA72,");
                strSql2.Append("'" + model.BAZA72 + "',");
            }
            if (model.BAZA73 != null)
            {
                strSql1.Append("BAZA73,");
                strSql2.Append("'" + model.BAZA73 + "',");
            }
            if (model.BAZA74 != null)
            {
                strSql1.Append("BAZA74,");
                strSql2.Append("'" + model.BAZA74 + "',");
            }
            if (model.BAZA75 != null)
            {
                strSql1.Append("BAZA75,");
                strSql2.Append("'" + model.BAZA75 + "',");
            }
            if (model.BAZA76 != null)
            {
                strSql1.Append("BAZA76,");
                strSql2.Append("'" + model.BAZA76 + "',");
            }
            if (model.BAZA77 != null)
            {
                strSql1.Append("BAZA77,");
                strSql2.Append("'" + model.BAZA77 + "',");
            }
            if (model.BAZA78 != null)
            {
                strSql1.Append("BAZA78,");
                strSql2.Append("'" + model.BAZA78 + "',");
            }
            if (model.BAZA79 != null)
            {
                strSql1.Append("BAZA79,");
                strSql2.Append("'" + model.BAZA79 + "',");
            }
            if (model.BAZA80 != null)
            {
                strSql1.Append("BAZA80,");
                strSql2.Append("'" + model.BAZA80 + "',");
            }
            if (model.BAZA81 != null)
            {
                strSql1.Append("BAZA81,");
                strSql2.Append("'" + model.BAZA81 + "',");
            }
            if (model.BAZA82 != null)
            {
                strSql1.Append("BAZA82,");
                strSql2.Append("'" + model.BAZA82 + "',");
            }
            if (model.BAZA83 != null)
            {
                strSql1.Append("BAZA83,");
                strSql2.Append("" + model.BAZA83 + ",");
            }
            if (model.BAZA84 != null)
            {
                strSql1.Append("BAZA84,");
                strSql2.Append("" + model.BAZA84 + ",");
            }
            if (model.BAZA85 != null)
            {
                strSql1.Append("BAZA85,");
                strSql2.Append("" + model.BAZA85 + ",");
            }
            if (model.BAZA86 != null)
            {
                strSql1.Append("BAZA86,");
                strSql2.Append("" + model.BAZA86 + ",");
            }
            if (model.BAZA87 != null)
            {
                strSql1.Append("BAZA87,");
                strSql2.Append("" + model.BAZA87 + ",");
            }
            if (model.BAZA88 != null)
            {
                strSql1.Append("BAZA88,");
                strSql2.Append("" + model.BAZA88 + ",");
            }
            if (model.BAZA89 != null)
            {
                strSql1.Append("BAZA89,");
                strSql2.Append("" + model.BAZA89 + ",");
            }
            if (model.BAZA90 != null)
            {
                strSql1.Append("BAZA90,");
                strSql2.Append("" + model.BAZA90 + ",");
            }
            if (model.BAZA91 != null)
            {
                strSql1.Append("BAZA91,");
                strSql2.Append("" + model.BAZA91 + ",");
            }
            if (model.BAZA92 != null)
            {
                strSql1.Append("BAZA92,");
                strSql2.Append("" + model.BAZA92 + ",");
            }
            if (model.BAZA93 != null)
            {
                strSql1.Append("BAZA93,");
                strSql2.Append("" + model.BAZA93 + ",");
            }
            if (model.BAZA94 != null)
            {
                strSql1.Append("BAZA94,");
                strSql2.Append("" + model.BAZA94 + ",");
            }
            if (model.BAZA95 != null)
            {
                strSql1.Append("BAZA95,");
                strSql2.Append("" + model.BAZA95 + ",");
            }
            if (model.BAZA96 != null)
            {
                strSql1.Append("BAZA96,");
                strSql2.Append("" + model.BAZA96 + ",");
            }
            if (model.BAZA97 != null)
            {
                strSql1.Append("BAZA97,");
                strSql2.Append("" + model.BAZA97 + ",");
            }
            if (model.BAZA98 != null)
            {
                strSql1.Append("BAZA98,");
                strSql2.Append("" + model.BAZA98 + ",");
            }
            if (model.BAZA99 != null)
            {
                strSql1.Append("BAZA99,");
                strSql2.Append("" + model.BAZA99 + ",");
            }
            if (model.BAZAA1 != null)
            {
                strSql1.Append("BAZAA1,");
                strSql2.Append("'" + model.BAZAA1 + "',");
            }
            if (model.BAZAA2 != null)
            {
                strSql1.Append("BAZAA2,");
                strSql2.Append("'" + model.BAZAA2 + "',");
            }
            if (model.BAZAA3 != null)
            {
                strSql1.Append("BAZAA3,");
                strSql2.Append("'" + model.BAZAA3 + "',");
            }
            if (model.BAZAA4 != null)
            {
                strSql1.Append("BAZAA4,");
                strSql2.Append("'" + model.BAZAA4 + "',");
            }
            if (model.BAZAA5 != null)
            {
                strSql1.Append("BAZAA5,");
                strSql2.Append("'" + model.BAZAA5 + "',");
            }
            if (model.BAZAB1 != null)
            {
                strSql1.Append("BAZAB1,");
                strSql2.Append("'" + model.BAZAB1 + "',");
            }
            if (model.BAZAB2 != null)
            {
                strSql1.Append("BAZAB2,");
                strSql2.Append("'" + model.BAZAB2 + "',");
            }
            if (model.BAZAB3 != null)
            {
                strSql1.Append("BAZAB3,");
                strSql2.Append("'" + model.BAZAB3 + "',");
            }
            if (model.BAZAB4 != null)
            {
                strSql1.Append("BAZAB4,");
                strSql2.Append("'" + model.BAZAB4 + "',");
            }
            if (model.BAZAB5 != null)
            {
                strSql1.Append("BAZAB5,");
                strSql2.Append("'" + model.BAZAB5 + "',");
            }
            if (model.BAZAB6 != null)
            {
                strSql1.Append("BAZAB6,");
                //strSql2.Append("'" + model.BAZAB6 + "',");
                strSql2.Append("{^" + Convert.ToDateTime(model.BAZAB6).ToString("yyyy-MM-dd") + "},");

            }
            if (model.BAZAB7 != null)
            {
                strSql1.Append("BAZAB7,");
                strSql2.Append("'" + model.BAZAB7 + "',");
            }
            if (model.BAZAB8 != null)
            {
                strSql1.Append("BAZAB8,");
                strSql2.Append("'" + model.BAZAB8 + "',");
            }
            if (model.BAZAC1 != null)
            {
                strSql1.Append("BAZAC1,");
                strSql2.Append("'" + model.BAZAC1 + "',");
            }
            if (model.BAZAC2 != null)
            {
                strSql1.Append("BAZAC2,");
                strSql2.Append("'" + model.BAZAC2 + "',");
            }
            if (model.BAZAC3 != null)
            {
                strSql1.Append("BAZAC3,");
                strSql2.Append("'" + model.BAZAC3 + "',");
            }
            if (model.BAZAC4 != null)
            {
                strSql1.Append("BAZAC4,");
                strSql2.Append("'" + model.BAZAC4 + "',");
            }
            if (model.BAZAC5 != null)
            {
                strSql1.Append("BAZAC5,");
                strSql2.Append("'" + model.BAZAC5 + "',");
            }
            if (model.BAZAC6 != null)
            {
                strSql1.Append("BAZAC6,");
                strSql2.Append("'" + model.BAZAC6 + "',");
            }
            if (model.BAZAC7 != null)
            {
                strSql1.Append("BAZAC7,");
                strSql2.Append("'" + model.BAZAC7 + "',");
            }
            if (model.BAZAC8 != null)
            {
                strSql1.Append("BAZAC8,");
                strSql2.Append("'" + model.BAZAC8 + "',");
            }
            if (model.BAZAC9 != null)
            {
                strSql1.Append("BAZAC9,");
                strSql2.Append("'" + model.BAZAC9 + "',");
            }
            if (model.BAZAD1 != null)
            {
                strSql1.Append("BAZAD1,");
                strSql2.Append("'" + model.BAZAD1 + "',");
            }
            if (model.BAZAD2 != null)
            {
                strSql1.Append("BAZAD2,");
                strSql2.Append("'" + model.BAZAD2 + "',");
            }
            if (model.BAZAD3 != null)
            {
                strSql1.Append("BAZAD3,");
                strSql2.Append("'" + model.BAZAD3 + "',");
            }
            if (model.BAZAD4 != null)
            {
                strSql1.Append("BAZAD4,");
                strSql2.Append("'" + model.BAZAD4 + "',");
            }
            if (model.BAZAD5 != null)
            {
                strSql1.Append("BAZAD5,");
                strSql2.Append("'" + model.BAZAD5 + "',");
            }
            if (model.BAZAD6 != null)
            {
                strSql1.Append("BAZAD6,");
                strSql2.Append("'" + model.BAZAD6 + "',");
            }
            if (model.BAZAD7 != null)
            {
                strSql1.Append("BAZAD7,");
                strSql2.Append("'" + model.BAZAD7 + "',");
            }
            if (model.BAZAE1 != null)
            {
                strSql1.Append("BAZAE1,");
                strSql2.Append("'" + model.BAZAE1 + "',");
            }
            if (model.BAZAE2 != null)
            {
                strSql1.Append("BAZAE2,");
                strSql2.Append("" + model.BAZAE2 + ",");
            }
            if (model.BAZAE3 != null)
            {
                strSql1.Append("BAZAE3,");
                strSql2.Append("" + model.BAZAE3 + ",");
            }
            if (model.BAZAE4 != null)
            {
                strSql1.Append("BAZAE4,");
                strSql2.Append("" + model.BAZAE4 + ",");
            }
            if (model.BAZAE5 != null)
            {
                strSql1.Append("BAZAE5,");
                strSql2.Append("" + model.BAZAE5 + ",");
            }
            if (model.BAZAE6 != null)
            {
                strSql1.Append("BAZAE6,");
                strSql2.Append("" + model.BAZAE6 + ",");
            }
            if (model.BAZAF1 != null)
            {
                strSql1.Append("BAZAF1,");
                strSql2.Append("'" + model.BAZAF1 + "',");
            }
            if (model.BAZAF4 != null)
            {
                strSql1.Append("BAZAF4,");
                strSql2.Append("'" + model.BAZAF4 + "',");
            }
            if (model.BAZAF5 != null)
            {
                strSql1.Append("BAZAF5,");
                strSql2.Append("'" + model.BAZAF5 + "',");
            }
            if (model.BAZAF6 != null)
            {
                strSql1.Append("BAZAF6,");
                strSql2.Append("'" + model.BAZAF6 + "',");
            }
            if (model.BAZAF7 != null)
            {
                strSql1.Append("BAZAF7,");
                strSql2.Append("'" + model.BAZAF7 + "',");
            }
            if (model.BAZAF8 != null)
            {
                strSql1.Append("BAZAF8,");
                strSql2.Append("'" + model.BAZAF8 + "',");
            }
            if (model.BAZAF9 != null)
            {
                strSql1.Append("BAZAF9,");
                strSql2.Append("'" + model.BAZAF9 + "',");
            }


            strSql.Append("insert into BAZA(");
            strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
            strSql.Append(")");

            #endregion

            //DbCommand cmd = DataAccess.GetSqlStringCommand(strSql.ToString());

            OdbcCommand cmd = new OdbcCommand();
            cmd.CommandText = strSql.ToString();
            cmd.CommandType = CommandType.Text;
            return OtherDataAccessFactory.Instance().ExecuteCommand(cmd, trans);
        }





        /// <summary>
        /// 更新一条数据
        /// </summary>
        public SqlExecuteResult Update(Atom.Entity.Medicare.BAZAEntity model)
        {
            StringBuilder strSql = new StringBuilder();
            #region 拼SQL语句

            strSql.Append("update BAZA set ");
            if (model.BAZA02 != null)
            {
                strSql.Append("BAZA02='" + model.BAZA02 + "',");
            }
            if (model.BAZA03 != null)
            {
                strSql.Append("BAZA03='" + model.BAZA03 + "',");
            }
            if (model.BAZA04 != null)
            {
                strSql.Append("BAZA04='" + model.BAZA04 + "',");
            }
            if (model.BAZA05 != null)
            {
                strSql.Append("BAZA05='" + model.BAZA05 + "',");
            }
            if (model.BAZA06 != null)
            {
                strSql.Append("BAZA06=" + model.BAZA06 + ",");
            }
            if (model.BAZA07 != null)
            {
                strSql.Append("BAZA07='" + model.BAZA07 + "',");
            }
            if (model.BAZA08 != null)
            {
                strSql.Append("BAZA08='" + model.BAZA08 + "',");
            }
            if (model.BAZA09 != null)
            {
                strSql.Append("BAZA09='" + model.BAZA09 + "',");
            }
            if (model.BAZA10 != null)
            {
                strSql.Append("BAZA10='" + model.BAZA10 + "',");
            }
            if (model.BAZA11 != null)
            {
                strSql.Append("BAZA11='" + model.BAZA11 + "',");
            }
            if (model.BAZA12 != null)
            {
                strSql.Append("BAZA12='" + model.BAZA12 + "',");
            }
            if (model.BAZA13 != null)
            {
                strSql.Append("BAZA13='" + model.BAZA13 + "',");
            }
            if (model.BAZA14 != null)
            {
                strSql.Append("BAZA14='" + model.BAZA14 + "',");
            }
            if (model.BAZA15 != null)
            {
                strSql.Append("BAZA15='" + model.BAZA15 + "',");
            }
            if (model.BAZA16 != null)
            {
                strSql.Append("BAZA16='" + model.BAZA16 + "',");
            }
            if (model.BAZA17 != null)
            {
                strSql.Append("BAZA17='" + model.BAZA17 + "',");
            }
            if (model.BAZA18 != null)
            {
                strSql.Append("BAZA18='" + model.BAZA18 + "',");
            }
            if (model.BAZA19 != null)
            {
                strSql.Append("BAZA19='" + model.BAZA19 + "',");
            }
            if (model.BAZA20 != null)
            {
                strSql.Append("BAZA20='" + model.BAZA20 + "',");
            }
            if (model.BAZA21 != null)
            {
                strSql.Append("BAZA21='" + model.BAZA21 + "',");
            }
            if (model.BAZA22 != null)
            {
                strSql.Append("BAZA22='" + model.BAZA22 + "',");
            }
            if (model.BAZA23 != null)
            {
                strSql.Append("BAZA23='" + model.BAZA23 + "',");
            }
            if (model.BAZA24 != null)
            {
                strSql.Append("BAZA24='" + model.BAZA24 + "',");
            }
            if (model.BAZA25 != null)
            {
                strSql.Append("BAZA25='" + model.BAZA25 + "',");
            }
            if (model.BAZA26 != null)
            {
                strSql.Append("BAZA26='" + model.BAZA26 + "',");
            }
            if (model.BAZA27 != null)
            {
                strSql.Append("BAZA27='" + model.BAZA27 + "',");
            }
            if (model.BAZA28 != null)
            {
                strSql.Append("BAZA28='" + model.BAZA28 + "',");
            }
            if (model.BAZA29 != null)
            {
                strSql.Append("BAZA29=" + model.BAZA29 + ",");
            }
            if (model.BAZA30 != null)
            {
                strSql.Append("BAZA30='" + model.BAZA30 + "',");
            }
            if (model.BAZA31 != null)
            {
                strSql.Append("BAZA31=" + model.BAZA31 + ",");
            }
            if (model.BAZA32 != null)
            {
                strSql.Append("BAZA32='" + model.BAZA32 + "',");
            }
            if (model.BAZA33 != null)
            {
                strSql.Append("BAZA33='" + model.BAZA33 + "',");
            }
            if (model.BAZA34 != null)
            {
                strSql.Append("BAZA34='" + model.BAZA34 + "',");
            }
            if (model.BAZA35 != null)
            {
                strSql.Append("BAZA35='" + model.BAZA35 + "',");
            }
            if (model.BAZA36 != null)
            {
                strSql.Append("BAZA36='" + model.BAZA36 + "',");
            }
            if (model.BAZA37 != null)
            {
                strSql.Append("BAZA37='" + model.BAZA37 + "',");
            }
            if (model.BAZA38 != null)
            {
                strSql.Append("BAZA38='" + model.BAZA38 + "',");
            }
            if (model.BAZA39 != null)
            {
                strSql.Append("BAZA39='" + model.BAZA39 + "',");
            }
            if (model.BAZA40 != null)
            {
                strSql.Append("BAZA40='" + model.BAZA40 + "',");
            }
            if (model.BAZA41 != null)
            {
                strSql.Append("BAZA41='" + model.BAZA41 + "',");
            }
            if (model.BAZA42 != null)
            {
                strSql.Append("BAZA42=" + model.BAZA42 + ",");
            }
            if (model.BAZA43 != null)
            {
                strSql.Append("BAZA43='" + model.BAZA43 + "',");
            }
            if (model.BAZA44 != null)
            {
                strSql.Append("BAZA44='" + model.BAZA44 + "',");
            }
            if (model.BAZA44A != null)
            {
                strSql.Append("BAZA44a='" + model.BAZA44A + "',");
            }
            if (model.BAZA45 != null)
            {
                strSql.Append("BAZA45='" + model.BAZA45 + "',");
            }
            if (model.BAZA46 != null)
            {
                strSql.Append("BAZA46=" + model.BAZA46 + ",");
            }
            if (model.BAZA47 != null)
            {
                strSql.Append("BAZA47=" + model.BAZA47 + ",");
            }
            if (model.BAZA48 != null)
            {
                strSql.Append("BAZA48='" + model.BAZA48 + "',");
            }
            if (model.BAZA49 != null)
            {
                strSql.Append("BAZA49='" + model.BAZA49 + "',");
            }
            if (model.BAZA50 != null)
            {
                strSql.Append("BAZA50='" + model.BAZA50 + "',");
            }
            if (model.BAZA51 != null)
            {
                strSql.Append("BAZA51='" + model.BAZA51 + "',");
            }
            if (model.BAZA52 != null)
            {
                strSql.Append("BAZA52='" + model.BAZA52 + "',");
            }
            if (model.BAZA53 != null)
            {
                strSql.Append("BAZA53='" + model.BAZA53 + "',");
            }
            if (model.BAZA54 != null)
            {
                strSql.Append("BAZA54='" + model.BAZA54 + "',");
            }
            if (model.BAZA54A != null)
            {
                strSql.Append("BAZA54A='" + model.BAZA54A + "',");
            }
            if (model.BAZA55 != null)
            {
                strSql.Append("BAZA55='" + model.BAZA55 + "',");
            }
            if (model.BAZA56 != null)
            {
                strSql.Append("BAZA56='" + model.BAZA56 + "',");
            }
            if (model.BAZA57 != null)
            {
                strSql.Append("BAZA57='" + model.BAZA57 + "',");
            }
            if (model.BAZA58 != null)
            {
                strSql.Append("BAZA58='" + model.BAZA58 + "',");
            }
            if (model.BAZA59 != null)
            {
                strSql.Append("BAZA59='" + model.BAZA59 + "',");
            }
            if (model.BAZA60 != null)
            {
                strSql.Append("BAZA60='" + model.BAZA60 + "',");
            }
            if (model.BAZA61 != null)
            {
                strSql.Append("BAZA61='" + model.BAZA61 + "',");
            }
            if (model.BAZA62 != null)
            {
                strSql.Append("BAZA62='" + model.BAZA62 + "',");
            }
            if (model.BAZA63 != null)
            {
                strSql.Append("BAZA63='" + model.BAZA63 + "',");
            }
            if (model.BAZA64 != null)
            {
                strSql.Append("BAZA64='" + model.BAZA64 + "',");
            }
            if (model.BAZA65 != null)
            {
                strSql.Append("BAZA65='" + model.BAZA65 + "',");
            }
            if (model.BAZA66 != null)
            {
                strSql.Append("BAZA66='" + model.BAZA66 + "',");
            }
            if (model.BAZA67 != null)
            {
                strSql.Append("BAZA67='" + model.BAZA67 + "',");
            }
            if (model.BAZA68 != null)
            {
                strSql.Append("BAZA68='" + model.BAZA68 + "',");
            }
            if (model.BAZA69 != null)
            {
                strSql.Append("BAZA69='" + model.BAZA69 + "',");
            }
            if (model.BAZA70 != null)
            {
                strSql.Append("BAZA70='" + model.BAZA70 + "',");
            }
            if (model.BAZA71 != null)
            {
                strSql.Append("BAZA71='" + model.BAZA71 + "',");
            }
            if (model.BAZA72 != null)
            {
                strSql.Append("BAZA72='" + model.BAZA72 + "',");
            }
            if (model.BAZA73 != null)
            {
                strSql.Append("BAZA73='" + model.BAZA73 + "',");
            }
            if (model.BAZA74 != null)
            {
                strSql.Append("BAZA74='" + model.BAZA74 + "',");
            }
            if (model.BAZA75 != null)
            {
                strSql.Append("BAZA75='" + model.BAZA75 + "',");
            }
            if (model.BAZA76 != null)
            {
                strSql.Append("BAZA76='" + model.BAZA76 + "',");
            }
            if (model.BAZA77 != null)
            {
                strSql.Append("BAZA77='" + model.BAZA77 + "',");
            }
            if (model.BAZA78 != null)
            {
                strSql.Append("BAZA78='" + model.BAZA78 + "',");
            }
            if (model.BAZA79 != null)
            {
                strSql.Append("BAZA79='" + model.BAZA79 + "',");
            }
            if (model.BAZA80 != null)
            {
                strSql.Append("BAZA80='" + model.BAZA80 + "',");
            }
            if (model.BAZA81 != null)
            {
                strSql.Append("BAZA81='" + model.BAZA81 + "',");
            }
            if (model.BAZA82 != null)
            {
                strSql.Append("BAZA82='" + model.BAZA82 + "',");
            }
            if (model.BAZA83 != null)
            {
                strSql.Append("BAZA83=" + model.BAZA83 + ",");
            }
            if (model.BAZA84 != null)
            {
                strSql.Append("BAZA84=" + model.BAZA84 + ",");
            }
            if (model.BAZA85 != null)
            {
                strSql.Append("BAZA85=" + model.BAZA85 + ",");
            }
            if (model.BAZA86 != null)
            {
                strSql.Append("BAZA86=" + model.BAZA86 + ",");
            }
            if (model.BAZA87 != null)
            {
                strSql.Append("BAZA87=" + model.BAZA87 + ",");
            }
            if (model.BAZA88 != null)
            {
                strSql.Append("BAZA88=" + model.BAZA88 + ",");
            }
            if (model.BAZA89 != null)
            {
                strSql.Append("BAZA89=" + model.BAZA89 + ",");
            }
            if (model.BAZA90 != null)
            {
                strSql.Append("BAZA90=" + model.BAZA90 + ",");
            }
            if (model.BAZA91 != null)
            {
                strSql.Append("BAZA91=" + model.BAZA91 + ",");
            }
            if (model.BAZA92 != null)
            {
                strSql.Append("BAZA92=" + model.BAZA92 + ",");
            }
            if (model.BAZA93 != null)
            {
                strSql.Append("BAZA93=" + model.BAZA93 + ",");
            }
            if (model.BAZA94 != null)
            {
                strSql.Append("BAZA94=" + model.BAZA94 + ",");
            }
            if (model.BAZA95 != null)
            {
                strSql.Append("BAZA95=" + model.BAZA95 + ",");
            }
            if (model.BAZA96 != null)
            {
                strSql.Append("BAZA96=" + model.BAZA96 + ",");
            }
            if (model.BAZA97 != null)
            {
                strSql.Append("BAZA97=" + model.BAZA97 + ",");
            }
            if (model.BAZA98 != null)
            {
                strSql.Append("BAZA98=" + model.BAZA98 + ",");
            }
            if (model.BAZA99 != null)
            {
                strSql.Append("BAZA99=" + model.BAZA99 + ",");
            }
            if (model.BAZAA1 != null)
            {
                strSql.Append("BAZAA1='" + model.BAZAA1 + "',");
            }
            if (model.BAZAA2 != null)
            {
                strSql.Append("BAZAA2='" + model.BAZAA2 + "',");
            }
            if (model.BAZAA3 != null)
            {
                strSql.Append("BAZAA3='" + model.BAZAA3 + "',");
            }
            if (model.BAZAA4 != null)
            {
                strSql.Append("BAZAA4='" + model.BAZAA4 + "',");
            }
            if (model.BAZAA5 != null)
            {
                strSql.Append("BAZAA5='" + model.BAZAA5 + "',");
            }
            if (model.BAZAB1 != null)
            {
                strSql.Append("BAZAB1='" + model.BAZAB1 + "',");
            }
            if (model.BAZAB2 != null)
            {
                strSql.Append("BAZAB2='" + model.BAZAB2 + "',");
            }
            if (model.BAZAB3 != null)
            {
                strSql.Append("BAZAB3='" + model.BAZAB3 + "',");
            }
            if (model.BAZAB4 != null)
            {
                strSql.Append("BAZAB4='" + model.BAZAB4 + "',");
            }
            if (model.BAZAB5 != null)
            {
                strSql.Append("BAZAB5='" + model.BAZAB5 + "',");
            }
            if (model.BAZAB6 != null)
            {
                strSql.Append("BAZAB6='" + model.BAZAB6 + "',");
            }
            if (model.BAZAB7 != null)
            {
                strSql.Append("BAZAB7='" + model.BAZAB7 + "',");
            }
            if (model.BAZAB8 != null)
            {
                strSql.Append("BAZAB8='" + model.BAZAB8 + "',");
            }
            if (model.BAZAC1 != null)
            {
                strSql.Append("BAZAC1='" + model.BAZAC1 + "',");
            }
            if (model.BAZAC2 != null)
            {
                strSql.Append("BAZAC2='" + model.BAZAC2 + "',");
            }
            if (model.BAZAC3 != null)
            {
                strSql.Append("BAZAC3='" + model.BAZAC3 + "',");
            }
            if (model.BAZAC4 != null)
            {
                strSql.Append("BAZAC4='" + model.BAZAC4 + "',");
            }
            if (model.BAZAC5 != null)
            {
                strSql.Append("BAZAC5='" + model.BAZAC5 + "',");
            }
            if (model.BAZAC6 != null)
            {
                strSql.Append("BAZAC6='" + model.BAZAC6 + "',");
            }
            if (model.BAZAC7 != null)
            {
                strSql.Append("BAZAC7='" + model.BAZAC7 + "',");
            }
            if (model.BAZAC8 != null)
            {
                strSql.Append("BAZAC8='" + model.BAZAC8 + "',");
            }
            if (model.BAZAC9 != null)
            {
                strSql.Append("BAZAC9='" + model.BAZAC9 + "',");
            }
            if (model.BAZAD1 != null)
            {
                strSql.Append("BAZAD1='" + model.BAZAD1 + "',");
            }
            if (model.BAZAD2 != null)
            {
                strSql.Append("BAZAD2='" + model.BAZAD2 + "',");
            }
            if (model.BAZAD3 != null)
            {
                strSql.Append("BAZAD3='" + model.BAZAD3 + "',");
            }
            if (model.BAZAD4 != null)
            {
                strSql.Append("BAZAD4='" + model.BAZAD4 + "',");
            }
            if (model.BAZAD5 != null)
            {
                strSql.Append("BAZAD5='" + model.BAZAD5 + "',");
            }
            if (model.BAZAD6 != null)
            {
                strSql.Append("BAZAD6='" + model.BAZAD6 + "',");
            }
            if (model.BAZAD7 != null)
            {
                strSql.Append("BAZAD7='" + model.BAZAD7 + "',");
            }
            if (model.BAZAE1 != null)
            {
                strSql.Append("BAZAE1='" + model.BAZAE1 + "',");
            }
            if (model.BAZAE2 != null)
            {
                strSql.Append("BAZAE2=" + model.BAZAE2 + ",");
            }
            if (model.BAZAE3 != null)
            {
                strSql.Append("BAZAE3=" + model.BAZAE3 + ",");
            }
            if (model.BAZAE4 != null)
            {
                strSql.Append("BAZAE4=" + model.BAZAE4 + ",");
            }
            if (model.BAZAE5 != null)
            {
                strSql.Append("BAZAE5=" + model.BAZAE5 + ",");
            }
            if (model.BAZAE6 != null)
            {
                strSql.Append("BAZAE6=" + model.BAZAE6 + ",");
            }
            if (model.BAZAF1 != null)
            {
                strSql.Append("BAZAF1='" + model.BAZAF1 + "',");
            }
            if (model.BAZAF4 != null)
            {
                strSql.Append("BAZAF4='" + model.BAZAF4 + "',");
            }
            if (model.BAZAF5 != null)
            {
                strSql.Append("BAZAF5='" + model.BAZAF5 + "',");
            }
            if (model.BAZAF6 != null)
            {
                strSql.Append("BAZAF6='" + model.BAZAF6 + "',");
            }
            if (model.BAZAF7 != null)
            {
                strSql.Append("BAZAF7='" + model.BAZAF7 + "',");
            }
            if (model.BAZAF8 != null)
            {
                strSql.Append("BAZAF8='" + model.BAZAF8 + "',");
            }
            if (model.BAZAF9 != null)
            {
                strSql.Append("BAZAF9='" + model.BAZAF9 + "',");
            }
            int n = strSql.ToString().LastIndexOf(",");
            strSql.Remove(n, 1);
            strSql.Append(" where BAZA01='" + model.BAZA01 + "' ");

            #endregion


            DbCommand cmd = DataAccess.GetSqlStringCommand(strSql.ToString());
            return ExecuteCommand(cmd, null);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public SqlExecuteResult Delete(string BAZA01)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from BAZA ");
            strSql.Append(" where BAZA01='" + BAZA01 + "' ");
            DbCommand cmd = DataAccess.GetSqlStringCommand(strSql.ToString());
            return OtherDataAccessFactory.Instance().ExecuteCommand(cmd, null);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Atom.Entity.Medicare.BAZAEntity GetModel(string BAZA01)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1  ");
            strSql.Append(" BAZA01,BAZA02,BAZA03,BAZA04,BAZA05,BAZA06,BAZA07,BAZA08,BAZA09,BAZA10,BAZA11,BAZA12,BAZA13,BAZA14,BAZA15,BAZA16,BAZA17,BAZA18,BAZA19,BAZA20,BAZA21,BAZA22,BAZA23,BAZA24,BAZA25,BAZA26,BAZA27,BAZA28,BAZA29,BAZA30,BAZA31,BAZA32,BAZA33,BAZA34,BAZA35,BAZA36,BAZA37,BAZA38,BAZA39,BAZA40,BAZA41,BAZA42,BAZA43,BAZA44,BAZA44a,BAZA45,BAZA46,BAZA47,BAZA48,BAZA49,BAZA50,BAZA51,BAZA52,BAZA53,BAZA54,BAZA54A,BAZA55,BAZA56,BAZA57,BAZA58,BAZA59,BAZA60,BAZA61,BAZA62,BAZA63,BAZA64,BAZA65,BAZA66,BAZA67,BAZA68,BAZA69,BAZA70,BAZA71,BAZA72,BAZA73,BAZA74,BAZA75,BAZA76,BAZA77,BAZA78,BAZA79,BAZA80,BAZA81,BAZA82,BAZA83,BAZA84,BAZA85,BAZA86,BAZA87,BAZA88,BAZA89,BAZA90,BAZA91,BAZA92,BAZA93,BAZA94,BAZA95,BAZA96,BAZA97,BAZA98,BAZA99,BAZAA1,BAZAA2,BAZAA3,BAZAA4,BAZAA5,BAZAB1,BAZAB2,BAZAB3,BAZAB4,BAZAB5,BAZAB6,BAZAB7,BAZAB8,BAZAC1,BAZAC2,BAZAC3,BAZAC4,BAZAC5,BAZAC6,BAZAC7,BAZAC8,BAZAC9,BAZAD1,BAZAD2,BAZAD3,BAZAD4,BAZAD5,BAZAD6,BAZAD7,BAZAE1,BAZAE2,BAZAE3,BAZAE4,BAZAE5,BAZAE6,BAZAF1,BAZAF4,BAZAF5,BAZAF6,BAZAF7,BAZAF8,BAZAF9 ");
            strSql.Append(" from BAZA ");
            strSql.Append(" where BAZA01='" + BAZA01 + "' ");
            Atom.Entity.Medicare.BAZAEntity model = new Atom.Entity.Medicare.BAZAEntity();
            DbCommand cmd = DataAccess.GetSqlStringCommand(strSql.ToString());

            return DataAccessExtensive.ExecuteSingleEntity<BAZAEntity>(this.DataAccess, cmd);
        }

        /// <summary>
        ///  获取时间段内的病案接口存在的数据
        /// </summary>
        /// <param name="dtbegin"></param>
        /// <param name="dtend"></param>
        /// <returns></returns>
        public List<BAZAEntity> GetAllEntityByDate(DateTime dtbegin, DateTime dtEnd, string inhosid)
        {
            string sql = "select BAZA01 from BAZA where BAZA27 between {^" + dtbegin.ToString("yyyy-MM-dd") + " } and {^" + dtEnd.ToString("yyyy-MM-dd") + "";
            DbCommand cmd = DataAccess.GetSqlStringCommand(sql);
            //cmd.Parameters.Add(dtbegin.ToString("yyyy-MM-dd"));
            //cmd.Parameters.Add(dtend.ToString("yyyy-MM-dd"));

            return OtherDataAccessFactory.Instance().ExecuteListEntity<BAZAEntity>(cmd);


        }

        /// <summary>
        /// 根据起止时间段内删除病案数据
        /// </summary>
        /// <param name="dtbegin"></param>
        /// <param name="dtend"></param>
        /// <param name="trans"></param>
        /// <returns></returns>
        public SqlExecuteResult DeleteAllEntityByDate(DateTime dtbegin, DateTime dtend, DbTransaction trans)
        {
            string sql = "delete  from BAZA where BAZA27 between {^" + dtbegin.ToString("yyyy-MM-dd") + " } and {^" + dtend.ToString("yyyy-MM-dd") + "}";
            string sqlF1 = "delete  from BAF1 where BAZA01 in(select BAZA01 from BAZA where  BAZA27   between {^" + dtbegin.ToString("yyyy-MM-dd") + " } and {^" + dtend.ToString("yyyy-MM-dd") + "})";
            string sqlF2 = "delete  from BAF2 where BAZA01 in(select BAZA01 from BAZA where  BAZA27   between {^" + dtbegin.ToString("yyyy-MM-dd") + " } and {^" + dtend.ToString("yyyy-MM-dd") + "}) ";
            string sqlF3 = "delete  from BAF3 where BAZA01 in(select BAZA01 from BAZA where  BAZA27   between {^" + dtbegin.ToString("yyyy-MM-dd") + " } and {^" + dtend.ToString("yyyy-MM-dd") + "})";
            string sqlF4 = "delete  from BAF4 where BAZA01 in(select BAZA01 from BAZA where  BAZA27   between {^" + dtbegin.ToString("yyyy-MM-dd") + " } and {^" + dtend.ToString("yyyy-MM-dd") + "})";
            string sqlF5 = "delete  from BAF5 where BAZA01 in(select BAZA01 from BAZA where  BAZA27   between {^" + dtbegin.ToString("yyyy-MM-dd") + " } and {^" + dtend.ToString("yyyy-MM-dd") + "})";
            string sqlF9 = "delete  from BAF9 where BAZA01 in(select BAZA01 from BAZA where  BAZA27   between {^" + dtbegin.ToString("yyyy-MM-dd") + " } and {^" + dtend.ToString("yyyy-MM-dd") + "})";
            string sqlFA = "delete  from BAFA where BAZA01 in(select BAZA01 from BAZA where  BAZA27   between {^" + dtbegin.ToString("yyyy-MM-dd") + " } and {^" + dtend.ToString("yyyy-MM-dd") + "})";
            string sqlFB = "delete  from BAFB where BAZA01 in(select BAZA01 from BAZA where  BAZA27   between {^" + dtbegin.ToString("yyyy-MM-dd") + " } and {^" + dtend.ToString("yyyy-MM-dd") + "})";
            string sqlFC = "delete  from BAFC where BAZA01 in(select BAZA01 from BAZA where  BAZA27   between {^" + dtbegin.ToString("yyyy-MM-dd") + " } and {^" + dtend.ToString("yyyy-MM-dd") + "})";
            string sqlFD = "delete  from BAFD where BAZA01 in(select BAZA01 from BAZA where  BAZA27   between {^" + dtbegin.ToString("yyyy-MM-dd") + " } and {^" + dtend.ToString("yyyy-MM-dd") + "})";
            string sqlpack = "pack BAZA";
            List<DbCommand> cmds = new List<DbCommand>();

            DbCommand cmd = DataAccess.GetSqlStringCommand(sql);
            DbCommand cmdsqlF1 = DataAccess.GetSqlStringCommand(sqlF1);
            DbCommand cmdsqlF2 = DataAccess.GetSqlStringCommand(sqlF2);
            DbCommand cmdsqlF3 = DataAccess.GetSqlStringCommand(sqlF3);
            DbCommand cmdsqlF4 = DataAccess.GetSqlStringCommand(sqlF4);
            DbCommand cmdsqlF5 = DataAccess.GetSqlStringCommand(sqlF5);
            DbCommand cmdsqlF9 = DataAccess.GetSqlStringCommand(sqlF9);
            DbCommand cmdsqlFA = DataAccess.GetSqlStringCommand(sqlFA);
            DbCommand cmdsqlFB = DataAccess.GetSqlStringCommand(sqlFB);
            DbCommand cmdsqlFC = DataAccess.GetSqlStringCommand(sqlFC);
            DbCommand cmdsqlFD = DataAccess.GetSqlStringCommand(sqlFD);

            DbCommand cmdsqlPack = DataAccess.GetSqlStringCommand(sqlpack);


            cmds.Add(cmdsqlF1);
            cmds.Add(cmdsqlF2);
            cmds.Add(cmdsqlF3);
            cmds.Add(cmdsqlF4);
            cmds.Add(cmdsqlF5);
            cmds.Add(cmdsqlF9);
            cmds.Add(cmdsqlFA);
            cmds.Add(cmdsqlFB);
            cmds.Add(cmdsqlFC);
            cmds.Add(cmdsqlFD);
            cmds.Add(cmd);
            cmds.Add(cmdsqlPack);

            //cmd.Parameters.Add(dtbegin.ToString("yyyy-MM-dd"));
            //cmd.Parameters.Add(dtend.ToString("yyyy-MM-dd"));

            return OtherDataAccessFactory.Instance().ExecuteCommands(cmds, trans);


        }


        /// <summary>
        /// 根据住院号删除
        /// </summary>
        /// <param name="dtbegin"></param>
        /// <param name="dtend"></param>
        /// <param name="trans"></param>
        /// <returns></returns>
        public SqlExecuteResult DeleteAllEntityByDate(string inhosid, DbTransaction trans)
        {
            string sql = "delete  from BAZA where BAZA01 ='" + inhosid + "'";
            string sqlF1 = "delete  from BAF1 where BAZA01 ='" + inhosid + "'";
            string sqlF2 = "delete  from BAF2 where BAZA01 ='" + inhosid + "'";
            string sqlF3 = "delete  from BAF3 where BAZA01 ='" + inhosid + "'";
            string sqlF4 = "delete  from BAF4 where BAZA01 ='" + inhosid + "'";
            string sqlF5 = "delete  from BAF5 where BAZA01 ='" + inhosid + "'";
            string sqlF9 = "delete  from BAF9 where BAZA01 ='" + inhosid + "'";
            string sqlFA = "delete  from BAFA where BAZA01 ='" + inhosid + "'";
            string sqlFB = "delete  from BAFB where BAZA01 ='" + inhosid + "'";
            string sqlFC = "delete  from BAFC where BAZA01 ='" + inhosid + "'";
            string sqlFD = "delete  from BAFD where BAZA01 ='" + inhosid + "'";
            string sqlpack = "pack BAZA";
            List<DbCommand> cmds = new List<DbCommand>();

            DbCommand cmd = DataAccess.GetSqlStringCommand(sql);
            DbCommand cmdsqlF1 = DataAccess.GetSqlStringCommand(sqlF1);
            DbCommand cmdsqlF2 = DataAccess.GetSqlStringCommand(sqlF2);
            DbCommand cmdsqlF3 = DataAccess.GetSqlStringCommand(sqlF3);
            DbCommand cmdsqlF4 = DataAccess.GetSqlStringCommand(sqlF4);
            DbCommand cmdsqlF5 = DataAccess.GetSqlStringCommand(sqlF5);
            DbCommand cmdsqlF9 = DataAccess.GetSqlStringCommand(sqlF9);
            DbCommand cmdsqlFA = DataAccess.GetSqlStringCommand(sqlFA);
            DbCommand cmdsqlFB = DataAccess.GetSqlStringCommand(sqlFB);
            DbCommand cmdsqlFC = DataAccess.GetSqlStringCommand(sqlFC);
            DbCommand cmdsqlFD = DataAccess.GetSqlStringCommand(sqlFD);

            DbCommand cmdsqlPack = DataAccess.GetSqlStringCommand(sqlpack);


            cmds.Add(cmdsqlF1);
            cmds.Add(cmdsqlF2);
            cmds.Add(cmdsqlF3);
            cmds.Add(cmdsqlF4);
            cmds.Add(cmdsqlF5);
            cmds.Add(cmdsqlF9);
            cmds.Add(cmdsqlFA);
            cmds.Add(cmdsqlFB);
            cmds.Add(cmdsqlFC);
            cmds.Add(cmdsqlFD);
            cmds.Add(cmd);
            cmds.Add(cmdsqlPack);

            //cmd.Parameters.Add(dtbegin.ToString("yyyy-MM-dd"));
            //cmd.Parameters.Add(dtend.ToString("yyyy-MM-dd"));

            return OtherDataAccessFactory.Instance().ExecuteCommands(cmds, trans);


        }

        #endregion  成员方法

        #region 我的关注实体属性与数据库列对应关系
        /// ---------------------------------------------------------------------
        /// <summary>
        /// 我的关注实体属性与数据库列对应关系
        /// </summary>
        /// <param name="entity">实体</param>
        /// <param name="reader">数据行</param>
        /// <history>[兆尹科技(liujian)] 2010/07/28 Created</history>
        /// ---------------------------------------------------------------------
        private void SetEntityBAZA(BAZAEntity entity, IDataReader reader)
        {
            SetEntityUti(entity, "BAZA01", "BAZA01", reader);
            SetEntityUti(entity, "BAZA02", "BAZA02", reader);
            SetEntityUti(entity, "BAZA03", "BAZA03", reader);
            SetEntityUti(entity, "BAZA04", "BAZA04", reader);
            SetEntityUti(entity, "BAZA05", "BAZA05", reader);
            SetEntityUti(entity, "BAZA06", "BAZA06", reader);
            SetEntityUti(entity, "BAZA07", "BAZA07", reader);
            SetEntityUti(entity, "BAZA08", "BAZA08", reader);
            SetEntityUti(entity, "BAZA09", "BAZA09", reader);
            SetEntityUti(entity, "BAZA10", "BAZA10", reader);
            SetEntityUti(entity, "BAZA11", "BAZA11", reader);
            SetEntityUti(entity, "BAZA12", "BAZA12", reader);
            SetEntityUti(entity, "BAZA13", "BAZA13", reader);
            SetEntityUti(entity, "BAZA14", "BAZA14", reader);
            SetEntityUti(entity, "BAZA15", "BAZA15", reader);
            SetEntityUti(entity, "BAZA16", "BAZA16", reader);
            SetEntityUti(entity, "BAZA17", "BAZA17", reader);
            SetEntityUti(entity, "BAZA18", "BAZA18", reader);
            SetEntityUti(entity, "BAZA19", "BAZA19", reader);
            SetEntityUti(entity, "BAZA20", "BAZA20", reader);
            SetEntityUti(entity, "BAZA21", "BAZA21", reader);
            SetEntityUti(entity, "BAZA22", "BAZA22", reader);
            SetEntityUti(entity, "BAZA23", "BAZA23", reader);
            SetEntityUti(entity, "BAZA24", "BAZA24", reader);
            SetEntityUti(entity, "BAZA25", "BAZA25", reader);
            SetEntityUti(entity, "BAZA26", "BAZA26", reader);
            SetEntityUti(entity, "BAZA27", "BAZA27", reader);
            SetEntityUti(entity, "BAZA28", "BAZA28", reader);
            SetEntityUti(entity, "BAZA29", "BAZA29", reader);
            SetEntityUti(entity, "BAZA30", "BAZA30", reader);
            SetEntityUti(entity, "BAZA31", "BAZA31", reader);
            SetEntityUti(entity, "BAZA32", "BAZA32", reader);
            SetEntityUti(entity, "BAZA33", "BAZA33", reader);
            SetEntityUti(entity, "BAZA34", "BAZA34", reader);
            SetEntityUti(entity, "BAZA35", "BAZA35", reader);
            SetEntityUti(entity, "BAZA36", "BAZA36", reader);
            SetEntityUti(entity, "BAZA37", "BAZA37", reader);
            SetEntityUti(entity, "BAZA38", "BAZA38", reader);
            SetEntityUti(entity, "BAZA39", "BAZA39", reader);
            SetEntityUti(entity, "BAZA40", "BAZA40", reader);
            SetEntityUti(entity, "BAZA41", "BAZA41", reader);

            SetEntityUti(entity, "BAZA61", "BAZA61", reader);
            SetEntityUti(entity, "BAZA62", "BAZA62", reader);
            SetEntityUti(entity, "BAZA63", "BAZA63", reader);
            SetEntityUti(entity, "BAZA64", "BAZA64", reader);
            SetEntityUti(entity, "BAZA65", "BAZA65", reader);
            SetEntityUti(entity, "BAZA66", "BAZA66", reader);
            SetEntityUti(entity, "BAZA67", "BAZA67", reader);
            SetEntityUti(entity, "BAZA68", "BAZA68", reader);
            SetEntityUti(entity, "BAZA69", "BAZA69", reader);
            SetEntityUti(entity, "BAZA70", "BAZA70", reader);
            SetEntityUti(entity, "BAZA71", "BAZA71", reader);
            SetEntityUti(entity, "BAZA72", "BAZA72", reader);
            SetEntityUti(entity, "BAZA73", "BAZA73", reader);
            SetEntityUti(entity, "BAZA74", "BAZA74", reader);
            SetEntityUti(entity, "BAZA75", "BAZA75", reader);
            SetEntityUti(entity, "BAZA76", "BAZA76", reader);
            SetEntityUti(entity, "BAZA77", "BAZA77", reader);
            SetEntityUti(entity, "BAZA78", "BAZA78", reader);
            SetEntityUti(entity, "BAZA79", "BAZA79", reader);
            SetEntityUti(entity, "BAZA80", "BAZA80", reader);
            SetEntityUti(entity, "BAZA81", "BAZA81", reader);
            SetEntityUti(entity, "BAZA82", "BAZA82", reader);
            SetEntityUti(entity, "", "URL", reader);
            SetEntityUti(entity, "", "URL", reader);
            SetEntityUti(entity, "", "URL", reader);
            SetEntityUti(entity, "", "URL", reader);
            SetEntityUti(entity, "BAZAA1", "BAZAA1", reader);
            SetEntityUti(entity, "BAZAA2", "BAZAA2", reader);
            SetEntityUti(entity, "BAZAA3", "BAZAA3", reader);
            SetEntityUti(entity, "BAZAA4", "BAZAA4", reader);
            SetEntityUti(entity, "BAZAA5", "BAZAA5", reader);
            SetEntityUti(entity, "BAZAB1", "BAZAB1", reader);
            SetEntityUti(entity, "BAZAB2", "BAZAB2", reader);
            SetEntityUti(entity, "BAZAB3", "BAZAB3", reader);
            SetEntityUti(entity, "BAZAB4", "BAZAB4", reader);
            SetEntityUti(entity, "BAZAB5", "BAZAB5", reader);
            SetEntityUti(entity, "BAZAB6", "BAZAB6", reader);

            SetEntityUti(entity, "BAZAB7", "BAZAB7", reader);
            SetEntityUti(entity, "BAZAB8", "BAZAB8", reader);
            SetEntityUti(entity, "BAZAC1", "BAZAC1", reader);
            SetEntityUti(entity, "BAZAC2", "BAZAC2", reader);
            SetEntityUti(entity, "BAZAC3", "BAZAC3", reader);
            SetEntityUti(entity, "BAZAC4", "BAZAC4", reader);
            SetEntityUti(entity, "BAZAC5", "BAZAC5", reader);
            SetEntityUti(entity, "BAZAC6", "BAZAC6", reader);
            SetEntityUti(entity, "BAZAC7", "BAZAC7", reader);
            SetEntityUti(entity, "BAZAC8", "BAZAC8", reader);
            SetEntityUti(entity, "BAZAC9", "BAZAC9", reader);
            SetEntityUti(entity, "BAZAD1", "BAZAD1", reader);
            SetEntityUti(entity, "BAZAD2", "BAZAD2", reader);
            SetEntityUti(entity, "BAZAD3", "BAZAD3", reader);
            SetEntityUti(entity, "BAZAD4", "BAZAD4", reader);
            SetEntityUti(entity, "BAZAD5", "BAZAD5", reader);
            SetEntityUti(entity, "BAZAD6", "BAZAD6", reader);
            SetEntityUti(entity, "BAZAD7", "BAZAD7", reader);
            SetEntityUti(entity, "BAZAE1", "BAZAE1", reader);
            SetEntityUti(entity, "BAZAE2", "BAZAE2", reader);



            SetEntityUti(entity, "BAZAF1", "BAZAF1", reader);
            SetEntityUti(entity, "BAZAF4", "BAZAF4", reader);
            SetEntityUti(entity, "BAZAF5", "BAZAF5", reader);
            SetEntityUti(entity, "BAZAF6", "BAZAF6", reader);
            SetEntityUti(entity, "BAZAF7", "BAZAF7", reader);
            SetEntityUti(entity, "BAZAF8", "BAZAF8", reader);
            SetEntityUti(entity, "BAZAF9", "BAZAF9", reader);
            SetEntityUti(entity, "BAZAB6", "BAZAB6", reader);



        }
        #endregion


        /*-----------------------------------------2011.06.08-----------------------------------------------------*/

         /// <summary>
        /// 根据起止时间段内删除病案数据
        /// </summary>
        /// <param name="dtbegin"></param>
        /// <param name="dtend"></param>
        /// <param name="trans"></param>
        /// <returns></returns>
        public SqlExecuteResult DeleteN04EntityByDate(DateTime dtbegin, DateTime dtend, DbTransaction trans)
        {
            string sql = "delete  from tcbasb ";
            string sqlpack = "pack tcbasb";
            List<DbCommand> cmds = new List<DbCommand>();

            DbCommand cmd = DataAccess.GetSqlStringCommand(sql);
          

            DbCommand cmdsqlPack = DataAccess.GetSqlStringCommand(sqlpack);


           
            cmds.Add(cmd);
            cmds.Add(cmdsqlPack);

            //cmd.Parameters.Add(dtbegin.ToString("yyyy-MM-dd"));
            //cmd.Parameters.Add(dtend.ToString("yyyy-MM-dd"));

            return OtherDataAccessFactory.Instance().ExecuteCommands(cmds, trans);
        }

        public SqlExecuteResult DeleteN04EntityByDate(string inhosid, DbTransaction trans)
        {
            string sql = "delete  from tcbasb where BAH ='" + inhosid + "'";
            string sqlpack = "pack tcbasb";
            List<DbCommand> cmds = new List<DbCommand>();

            DbCommand cmd = DataAccess.GetSqlStringCommand(sql);


            DbCommand cmdsqlPack = DataAccess.GetSqlStringCommand(sqlpack);



            cmds.Add(cmd);
            cmds.Add(cmdsqlPack);

            //cmd.Parameters.Add(dtbegin.ToString("yyyy-MM-dd"));
            //cmd.Parameters.Add(dtend.ToString("yyyy-MM-dd"));

            return OtherDataAccessFactory.Instance().ExecuteCommands(cmds, trans);
        }

    }
}
